package cn.ecnu.mapper;

import cn.ecnu.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    // 根据用户Id获取用户
    User getUserById(Integer userId);

    // 新增一个用户
    int insertUser(User user);

    // 根据用户号码查询用户
    @Select("SELECT * FROM psychology.user WHERE user_phone = #{phone} LIMIT 1")
    User getUserByPhone(@Param("phone") String phone);

    int updateUser(User user);

}
